The child watch source is the only thing that reaps the child process.
We cannot remove it until it fires or the child will remain a zombie.
So, just leave the source attached. Trying to remove it does not seem
easy, and I don't see any need; we expect the child process to exit
quickly, so this doesn't seem harmful.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7083
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3926>
(cherry picked from commit
961a7d721f3e4db9be6df958b10ba98955138cae)
else
this._readStdoutOldStyle();
- this._childWatch = GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid,
+ GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid,
this._vpnChildFinished.bind(this));
this._writeConnection();
return;
this.emit('destroy');
- if (this._childWatch)
- GLib.source_remove(this._childWatch);
this._stdin.close(null);
// Stdout is closed when we finish reading from it
}
_vpnChildFinished(pid, status, _requestObj) {
- this._childWatch = 0;
+ if (this._destroyed)
+ return;
if (this._newStylePlugin) {
// For new style plugin, all work is done in the async reading functions
// Just reap the process here